package com.stockz.ui.resource.image;

import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

import com.stockz.ui.swing.core.UISwingCoreConstant;

public class ImageIconLoader {

	public static ImageIcon loadImageIcon(String name){
		ImageIcon icon = null;
		try {
			icon = new ImageIcon(
					(ImageIO.read(ImageIconLoader.class.getResource(name))
					.getScaledInstance(UISwingCoreConstant.iconWidth, 
							UISwingCoreConstant.iconHeight, Image.SCALE_SMOOTH)));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return icon;
	}
	
	public static Image loadImage(String name){
		try {
				return ImageIO.read(ImageIconLoader.class.getResource(name));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
